<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>添加员工</title>
    <link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body>
<jsp:include page="menu.jsp"/>
<div class="index-content">
    <div class="index-content-operation">
        <a class="info-detail">添加员工</a>
        <br>
        <br>
    </div>
    <br>
    <form action="EmployeeServlet?action=add" method="post" onsubmit="return check()">
        <table class="index-content-table-add">
            <tr>
                <td width="12%">姓名：</td><td><input class="index-content-table-td-add" type="text" id="employeeName" name="employeeName" value=""/></td>
            </tr>
            <tr>
                <td width="12%">性别：</td><td><input name="employeeSex" type="radio" value="true" checked="checked"/>&nbsp;&nbsp;&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;<input name="employeeSex" value="false" type="radio"/>&nbsp;&nbsp;&nbsp;女</td>
            </tr>
            <tr>
                <td width="12%">电话：</td><td><input class="index-content-table-td-add" type="text" id="employeePhone" name="employeePhone" value=""/></td>
            </tr>
            <tr>
                <td width="12%">部门：</td><td><input class="index-content-table-td-add" type="text" id="employeeDept" name="employeeDept" value=""/></td>
            </tr>
            <tr>
                <td width="12%">职位：</td><td><input class="index-content-table-td-add" type="text" id="employeeJob" name="employeeJob" value=""/></td>
            </tr>
            <tr>
                <td width="12%">工号：</td><td><input class="index-content-table-td-add" type="text" id="employeeNo" name="employeeNo" value=""/></td>
            </tr>
            <tr>
                <td width="12%">年龄：</td><td><input class="index-content-table-td-add" type="text" id="employeeAge" name="employeeAge" value=""/></td>
            </tr>
            <tr>
                <td width="12%">学历：</td><td><input class="index-content-table-td-add" type="text" id="employeeEducation" name="employeeEducation" value=""/></td>
            </tr>
            <tr>
                <td width="12%">入职时间：</td><td><input class="index-content-table-td-add" type="text" id="employeeIntime" name="employeeIntime" value=""/></td>
            </tr>
            <tr>
                    <td width="12%">备注：</td><td><textarea id="employeeText" name="employeeText" style="width: 60%; height: 100px;padding: 0px 17px;" placeholder="请输入内容......"></textarea></td>
            </tr>
        </table>
        <br>
        <br>
        <br>
        &nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-3d btn-pill btn-success btn-sm">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" class="btn btn-3d btn-pill btn-success btn-sm" onclick="javascript:history.back(-1);">取消</button>
    </form>
</div>

</body>
<script type="text/javascript">
    //提交之前进行检查，如果return false，则不允许提交
    function check() {
        //根据ID获取值
        var employeeName = document.getElementById("employeeName").value;
        if (employeeName == "") {
            alert("姓名不能为空");
            return false;
        }
        var employeePhone = document.getElementById("employeePhone").value;
        if (employeePhone == "") {
            alert("电话不能为空");
            return false;
        }
        var employeeDept = document.getElementById("employeeDept").value;
        if (employeeDept == "") {
            alert("部门不能为空");
            return false;
        }
        var employeeJob = document.getElementById("employeeJob").value;
        if (employeeJob == "") {
            alert("职位不能为空");
            return false;
        }
        var employeeNo = document.getElementById("employeeNo").value;
        if (employeeNo == "") {
            alert("工号不能为空");
            return false;
        }
        var employeeAge = document.getElementById("employeeAge").value;
        if (employeeAge == "") {
            alert("年龄不能为空");
            return false;
        }
        var employeeEducation = document.getElementById("employeeEducation").value;
        if (employeeEducation == "") {
            alert("学历不能为空");
            return false;
        }
        var employeeIntime = document.getElementById("employeeIntime").value;
        if (employeeIntime == "") {
            alert("入职时间不能为空");
            return false;
        }
        return true;
    }
</script>
</html>
